<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>表单</title>
    <link href="/themes/icon.css" rel="stylesheet" type="text/css" >
    <link href="/themes/default/easyui.css" rel="stylesheet" type="text/css" >
    <script src="/js/jquery.min.js"></script>
    <script src="/js/jquery.easyui.min.js"></script>
    <script src="/js/easyui-lang-zh_CN.js"></script>
</head>
<body>
    <form id="ff" action="/aa/bb" method="post" >
        Name:<input class="easyui-textbox" name="name" data-options="required:true"  /><br/>
        Birthday:<input class="easyui-datebox" name="birthday" data-options="required:true"  /><br/>
        Language:
        <select name="language" class="easyui-combobox" style="width: 100px;" >
            <option value="java" >java</option>
            <option value="php" >php</option>
            <option value="c" >c</option>
        </select>
    </form>

    <a href="#" class="easyui-linkbutton" onclick="submitForm()" >提交</a>
    <a href="#" class="easyui-linkbutton" onclick="$('#ff').form('clear')" >清空</a>
    <a href="#" class="easyui-linkbutton" onclick="$('#ff').form('reset')" >重置</a>

    <script>

        $(function(){
            //先给表单绑定(初始化)数据
            $('#ff').form('load',{
                name:'name2',
                birthday:"03/3/2017",
                language:"c"
            });
        });


        function submitForm(){

            // //表单验证
            // if($('#ff').form('enableValidation').form("validate"))
            // {
            //     //如果直接提交表单直接使用submit()方法即可
            //     $('#ff').submit();
            // }

            //表单验证
            // if($('#ff').form("validate"))
            // {
            //     //如果表单提交直接使用submit()方法即可
            //     $('#ff').submit();
            // }

             //表单验证
            if($('#ff').form("validate"))
            {
                //ajax形式提交
                //$('#ff').form('submit');

                $('#ff').form('submit',{
                    onSubmit:function(){
                        //提交时相关逻辑处理
                        alert('提交了');
                        //如果不想使用easyui自带的提交这里返回false
                        return false;
                    }
                });
            }
          
        }
    </script>

</body>
</html>